import React, { FC, useState } from 'react';

const StateHook: FC<any> = () => {
    const [state, setState] = useState<number>(0);
    const [obj, setObj] = useState<{
        name: string;
        age: number;
    }>({
        name: '名字',
        age: 20,
    });
    return (
        <div>
            <button onClick={ () => {
                setState(state + 1);
            } }>点击
            </button>
            <div>state值-{ state }</div>

            <button onClick={ () => {
                setObj({name: 'zuijin', age: 20});
            } }>对象值
            </button>

            <div>{ obj.name }-{ obj.age }</div>
        </div>
    );
};

export default StateHook;